package com.lening.security.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lening.common.base.BaseController;
import com.lening.common.util.OssUtil;
import com.lening.common.web.Result;
import com.lening.security.dto.ProjectDTO;
import com.lening.security.po.ProjectPO;
import com.lening.security.service.IProjectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 赵子豪
 * @date 2024年06月04日 09时00分07秒
 * 巡检项目
 */
@Slf4j
@RestController
@RequestMapping("project")
public class ProjectController extends BaseController<ProjectPO, ProjectDTO, IProjectService> {
    @Autowired
    private IProjectService iProjectService;
    //分页
    @GetMapping("projectpage")
    public Page<ProjectDTO> projectpage(ProjectDTO projectDTO) {
        Page<ProjectDTO> projectpage = iProjectService.projectpage(projectDTO);
        return projectpage;
    }
//    @PostMapping("upload")
//    public Map<String, String> upload(@RequestParam("file") MultipartFile file) {
//        return iProjectService.upload(file);
//    }

    //    上传
    @PostMapping("UpLoad")
    public Result<?> upload(MultipartFile multipartFile) {
        String s = OssUtil.uploadFileAvatar(multipartFile);
        return Result.ok(s);
    }
}